package com.SpringBoot.Util;

import java.util.UUID;

public class Img {
    public static String extractFileName(String fileName) {
        //11.jpg
        // String fileName = file.getOriginalFilename();
        //.jpg 获得文件后缀名
        String extension = fileName.substring(fileName.lastIndexOf("."));
        //随机文件名 5014624afd02425d93289d766a653eda
        String randomFileName = UUID.randomUUID().toString().replace("-","");
        //5014624afd02425d93289d766a653eda.jpg
        return randomFileName + extension;
    }
}
